package response

import (
	"user-center/src/common"
)

type BaseResponse struct {
	Code        common.ErrCode `json:"code"`
	Data        interface{}    `json:"data"`
	Message     string         `json:"message"`
	Description string         `json:"description"`
}

func (rsp *BaseResponse) ResponseWithError(code common.ErrCode, msg string) {
	rsp.Code = code
	rsp.Message = msg
}

func (rsp *BaseResponse) ResponseSuccess() {
	rsp.Code = common.Success
	rsp.Message = "success"
}

func (rsp *BaseResponse) ResponseWithData(data interface{}) {
	rsp.Code = common.Success
	rsp.Message = "success"
	rsp.Data = data
}

func (rsp *BaseResponse) ResponseWithDescription(data interface{}, des string) {
	rsp.Code = common.Success
	rsp.Message = "success"
	rsp.Data = data
	rsp.Description = des
}
